$(function () {
    initMenu();
    
    function initMenu() {
        $(".navbar-nav li").each(function () {
            var authCode=$(this).attr("auth");
            if(!hasAuth(authCode)){
                $(this).hide();
            }
        });
    }
    function hasAuth(authCode) {
        var authArray=authStr.split(",");
        if(authArray&&authArray.length>0){
            for(var i=0;i<authArray.length;i++){
                if(authArray[i].trim()==authCode){
                    return true;
                }
            }
        }
        return false;
    }

    function tt(){
        alert("55");
    }

    $("body").on("click","#logout",function(){
        $.ajax({
            type:"post",
            url: ctx+"/logout.do",
            data:{},
            async:	true,
            cache: false,
            dataType:"json",
            beforeSend:function(){
                //layer.load(2);
            },success:function(data){
                if(data.code=="000000"){
                    location.reload();
                }else{
                    alert("系统异常，"+data.message);
                }
            },error:function(e){
                alert("系统异常，请稍后再试");
            },complete:function(){
                //layer.closeAll('loading');
            }
        });
    });
});
